<?php 
date_default_timezone_set('Asia/Krasnoyarsk');
?>
<!-- start content-outer ......................START -->
<div id="content-outer">
<!-- start content -->
<div id="content">

	<!--  start page-heading -->
	<div id="page-heading">
		<h1>Manage Documents</h1>
	</div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="<?php echo img_link('side_shadowleft.jpg');?>" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="<?php echo img_link('side_shadowright.jpg');?>" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td valign="top">
		<!--  start content-table-inner ...................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div class="newcust"><a href="<?php echo base_url().'document/upload/'?>" class="add_docs" title="New Agent">Upload Document</a></div>
			<span class="sercust">
			<div class="search_docs" title="Search Agents">Search Document</div>
			</span>
			<form method="get" action="">
			<table border="0" cellpadding="7" cellspacing="0">

              <tr>
                <td align="left">Name:</td>
                <td align="left"><input name="name" type="text" class="field" id="textfield" size="26" /></td>
                <td align="left">Type:</td>
                <td align="left"><select name="select" class="field" id="select">
                  <option value="1">Presentation Slides</option>
                  <option value="2">Statistics</option>
                </select>
                </td>
                <td><input type="submit" class="large button red" value="Search"/></td>
              </tr>
            </table>
            </form>
			<br />
			<table border="1" cellpadding="7" cellspacing="0" style="border-collapse:collapse;" bordercolor="#CCCCCC";>
              <tr>
                <td width="20" align="center" class="table-title">No.</td>
                <td width="300" align="left" class="table-title">Document Name</td>
                <td width="80" align="center" class="table-title">Upload Date</td>
                <td width="110" align="center" class="table-title">Type</td>
                <?php if($_SESSION['_user']['group_id']=='1'):?>
                <td width="40" align="center" class="table-title">Delete</td>
                <td width="40" align="center" class="table-title">Edit</td>
                <?php endif;?>
              </tr>
              <?php 
              foreach($documents as $k => $doc):
              ?>
              <tr>
                <td align="center"><?php echo($k+1);?></td>
                <td align="left"><a href="<?php echo base_url().'document/view/'.$doc->id;?>"><?php echo $doc->name;?></a></td>
                <td align="center"><?php echo date('d.m.Y',strtotime($doc->created_date));?></td>
                <td align="left"><?php echo($doc->cat==1 ? 'Presentation Slides' : 'Statistics');?></td>
                <?php if($_SESSION['_user']['group_id']=='1'):?>
                <td align="center"><a onclick="return confirm('Are you ok?');return false;" href="<?php echo base_url();?>document/del/<?php echo $doc->id;?>"><img src="<?php echo img_link('deletefile.gif');?>" alt="Delete" width="25" height="20" border="0" /></a></td>
                <td align="center"><a href="<?php echo base_url();?>document/edit/<?php echo $doc->id;?>">Edit</a></td>
                <?php endif;?>
              </tr>
              <?php 
              endforeach;
              ?>
              <tr>
              	<td colspan="5">
              		<?php echo $pagnav;?>
              	</td>
              </tr>
            </table>
			<div class="clear"></div>
		</div>
		<!--  end content-table-inner ......................END  --></td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>

</div>
<!--  end content -->